home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / winsock / ircii2-6.zip / SRC\IRCII-2.6\SCRIPT\AUTOOP < prev    next >
Text File  |  1994-12-28  |  3KB  |  101 lines

  1. # AutoOp   by Ian Frechette 12-10-92 
  2. # Written for ircII2.2pre8 and beyond
  3.  
  4. # initial list of trusted chan ops..
  5. # format is   nickname!username@hostname   wildcards can be used in 
  6. # any of the three fields
  7. # in the following list the first name would autoop anyone with the 
  8. # nickname 'example_nick'
  9. # the second example will autoop anyone with the username
  10. # 'bob' coming from any machine in the .nocolorado.edu domain
  11.  
  12. eval if (op_list == []) {@ op_list = [example_nick!*@* *!bob@*.nocolorado.edu]}
  13.  
  14. # People will only be opped on the following channels..  
  15. # wildcards are allowed and thus just * means every channel.  Use
  16. # delchan to remove stuff from the list, addchan to add
  17. eval if (chan_list == []) {@chan_list = [* #example]}
  18.  
  19. # Show the the people currently in the autoop list
  20. alias showop
  21. {
  22.     @ ao.tmp = 0
  23.     @ ao.name = []
  24.     echo *** AutoOp list.  Addop nick!user@host to add.  Delop <num>  to remove
  25.     echo *** <num> nickname!username@hostname 
  26.     while (ao.name = word($ao.tmp $op_list)) {
  27.         echo *** $[5]ao.tmp $ao.name
  28.         @ao.tmp = ao.tmp + 1
  29.     }
  30. }
  31.  
  32. # Just like showop but works with channels.
  33. alias showchan
  34. {
  35.     @ ao.tmp = 0
  36.     @ ao.name = []
  37.     echo *** AutoOp chan list.  Addchan #channel add.  Delchan <num>  to remove
  38.     echo *** <num> #channel
  39.     while (ao.name = word($ao.tmp $chan_list)) {
  40.         echo *** $[5]ao.tmp $ao.name
  41.         @ao.tmp = ao.tmp + 1
  42.     }
  43. }
  44.  
  45. # Given a number.. deletes that person from the autoop list.. 
  46. # use SHOWOP to list.
  47. alias delop {
  48.     if (!rmatch($0. *1* *2* *3* *4* *5* *6* *7* *8* *9* *0*))
  49.         { echo *** Usage: delop <number>;echo *** See showop }
  50.         { @ op_list = notword(${[$0] + 1} $op_list) }
  51. }
  52.     
  53. # Given a number.. deletes that channel from the autoop channel list.. 
  54. # use SHOWCHAN to list.
  55. alias delchan {
  56.     if (!rmatch($0. *1* *2* *3* *4* *5* *6* *7* *8* *9* *0*))
  57.         { echo *** Usage: delchan <number>;echo *** See showchan }
  58.         { @ chan_list = notword(${[$0] + 1} $chan_list) }
  59. }
  60.  
  61. # Add an autochanop to the list.
  62. alias addop {
  63.     if ([$0])
  64.     { @ op_list = op_list ## [ $0] }
  65.     { echo *** Usage addop nick!username@host;echo *** wildcards are allowed }
  66. }
  67.  
  68. # Add an autochanop channel to the list.
  69. alias addchan {
  70.     if ([$0])
  71.     { @ chan_list = chan_list ## [ $0] }
  72.     { echo *** Usage addchan #channel;echo *** wildcards are allowed }
  73. }
  74.  
  75. # the actual ON that does the work
  76. on #-join 666 * {
  77.     if (rmatch($1 $chan_list))
  78.     {
  79.     if (rmatch($0!$userhost() $op_list) && ischanop($N $1))
  80.         { timer ${10 + rand(10)} if \(!ischanop\($0 $1\)\) \{//mode $1 +o $0 \} }
  81.     }
  82. }
  83.  
  84. # The perfect complement to the $word() function.  
  85. # $notword(index words)  returns words minus the indexed word. 
  86. # the special handling of nw.sep is to deal with the cases when 
  87. # the index points to the first or last word.
  88. alias notword {
  89.     if ([$0] > 0)
  90.     {
  91.     if (([$0] > 1) && ([$0] < rmatch($~ $1-)))
  92.         { @ nw.sep = [ ] }
  93.         { @ nw.sep = [] }
  94.         
  95.     @ function_return = [$(1-${[$0]-1})] ## [$nw.sep] ## [$(${[$0]+1}-)]
  96.     }
  97.     {
  98.         @ function_return = [$1-]
  99.     }
  100. }
  101.